package guij.controller;

import java.util.List;

import guij.dao.mapper.SubscriberMapper;
import guij.dao.vo.Subscriber;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
//检索一个nick的 maillist
public class ShowMailSubs implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		if(arg0.getSession().getAttribute("Nick")!=null)
		{
			String nick = arg0.getSession().getAttribute("Nick").toString();
			List<Subscriber> subs = subscriberMapper.getSubs(nick);
			return new ModelAndView(getViewPage(),"subs",subs);
		}
		return null;
	}
	
	private String viewPage;
	public String getViewPage() {
		return viewPage;
	}

	public void setViewPage(String viewPage) {
		this.viewPage = viewPage;
	}

	private SubscriberMapper subscriberMapper;

	public SubscriberMapper getSubscriberMapper() {
		return subscriberMapper;
	}

	public void setSubscriberMapper(SubscriberMapper subscriberMapper) {
		this.subscriberMapper = subscriberMapper;
	}
}
